package com.ssh.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.ssh.entity.Happy;
import com.ssh.server.HappyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
@Scope("prototype")
public class HappyAction extends ActionSupport{
    @Autowired
    private HappyServer happyServer = null;

    public String execute() throws Exception{
        List<Happy> happyList = happyServer.getAllHappy();


        ActionContext.getContext().getValueStack().set("happyList",happyList);
        return this.SUCCESS;
    }
}
